package com.itstyle.quartz.job;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StopWatch;



public class ActiveMQPointJob implements Job,Serializable {
    private static final long serialVersionUID = -1742665702144459228L;

    private static final Logger log = LoggerFactory.getLogger(ActiveMQPointJob.class);

    @Autowired
    ActiveMQClient client;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        for (int i = 0; i < 1; i++) {
            client.send("发送消息----zhisheng-----"+System.currentTimeMillis());
        }
        stopWatch.stop();

        log.info("ActiveMQPointJob发送消息耗时: " + stopWatch.getTotalTimeMillis()+"毫秒");

    }
}
